Create Responsive navigation

Create Responsive navigation

HTML


<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
  </head>
  <body>
    <div class="main">
      <h1 class="logo">Spring Code</h1>

      <input type="checkbox" id="chk">

      <label for="chk" class="show-menu">
        <i class="fas fa-bars"></i>
      </label>

      <div id="second">
        <ul>
          <li><a href="#">Home</a></li>
          <li><a href="#">Contact</a></li>
          <li><a href="#">Services</a></li>
          <li><a href="#">About</a></li>

          <label for="chk" class="hide-menu">
            <i class="fas fa-times"></i>
          </label>
        </ul>
      </div>
    </div>
    <!-- End-HTML -->
  
<div style="text-align:right;position:fixed;bottom:3px;right:3px;width:100%;z-index:999999;cursor:pointer;line-height:0;display:block;"><a target="_blank" href="https://www.freewebhostingarea.com" title="Free Web Hosting with PHP8"><img alt="Free Web Hosting" src="https://www.freewebhostingarea.com/images/poweredby.png" style="border-width: 0px;width: 180px; height: 45px; float: right;"></a></div>
</body>
</html>
</div>

CSS


*{
  margin: 0;
  padding: 0;
  font-family: Montserrat;
  font-weight: bold;
}

.main{
  width: 100%;
  height: 60px;
  background: #929;
  position: relative;
}

.logo{
  position: absolute;
  bottom: 10px;
  left: 20px;
  color: #fff;
  float: left;
  text-transform: uppercase;
}

#chk{
  visibility: hidden;
}

.show-menu{
  float: right;
  line-height: 2;
  color: #fff;
  padding-right: 20px;
  font-size: 30px;
  transition: .3s;
  display: none;
}

#second{
  float: right;
  transition: all .8s;
}

#second ul{
  list-style: none;
}

.hide-menu{
  font-size: 15px;
  display: none;
  transition: .3s;
}

#second li{
  display: inline;
  padding: 0 8px;
  font-size: 18px;
  line-height: 3;
  padding-right: 20px;
}

#second ul li a{
  color: #fff;
  text-decoration: none;
}

#second ul li a:hover,
.hide-menu:hover,
.show-menu:hover{
  color: #00ffa5;
}

@media (max-width: 765px){
  .hide-menu,
  .show-menu{
    display: block;
  }
  .main{
    position: relative;
  }
  #second{
    position: absolute;
    float: none;
    background: #929;
    top: -860px;
    right: 0%;
  }

  #second ul li{
    display: block;
    line-height: 2;
    text-align: center;
    padding: 8px 40px;
  }
  .hide-menu{
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 20px;
  }

  #chk:checked ~ #second{
    top: 60px;
  }
}


See demo

CATEGORIES

Mainly CSS Mainly Html Java Script Plug-ins Responsive HTML/CSS Fixed CSS

Older Posts

Create Responsive Navigaion Create Fixed Contact Create Dropdowns Create easy Website Create Modal Fixed CSS